cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)

rosbuild_find_ros_package(actionlib_msgs)
include(${actionlib_msgs_PACKAGE_PATH}/cmake/actionbuild.cmake)
genaction()

rosbuild_init()

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

rosbuild_genmsg()
#rosbuild_gensrv()

# Build servers
rosbuild_add_boost_directories()
rosbuild_add_executable(find_marker_server src/servers/find_marker_server.cpp src/servers/base_server.cpp)
rosbuild_link_boost(find_marker_server thread)
rosbuild_add_executable(drop_ball_server src/servers/drop_ball_server.cpp src/servers/base_server.cpp)
rosbuild_link_boost(drop_ball_server thread)
rosbuild_add_executable(drive_server src/nodes/drive_server_node.cpp src/servers/drive_server.cpp src/servers/base_server.cpp)
rosbuild_link_boost(drive_server thread)
rosbuild_add_executable(grab_ball_server src/servers/grab_ball_server.cpp src/servers/base_server.cpp)
rosbuild_link_boost(grab_ball_server thread)
rosbuild_add_executable(idle_server src/servers/idle_server.cpp src/servers/base_server.cpp)
rosbuild_link_boost(idle_server thread)
rosbuild_add_executable(position_target_server src/nodes/position_target_server_node.cpp src/servers/position_target_server.cpp src/servers/base_server.cpp)
rosbuild_link_boost(position_target_server thread)
rosbuild_add_executable(manual_control_server src/nodes/manual_control_node.cpp src/servers/manual_control_server.cpp src/servers/base_server.cpp)
rosbuild_link_boost(manual_control_server thread)

# Build clients
rosbuild_add_executable(state_machine src/nodes/state_machine_node.cpp src/rp_states/state_machine.cpp)
rosbuild_link_boost(state_machine thread)

# Test code
rosbuild_add_executable(test_state_machine EXCLUDE_FROM_ALL test/state_machine_test.cpp src/rp_states/state_machine.cpp)
rosbuild_link_boost(test_state_machine thread)
rosbuild_add_gtest_build_flags(test_state_machine)
rosbuild_add_rostest(test/state_machine.test)
